package com.syni.mdd.sjb.common.datatreaure.controller.protect.dataTreasure.saasminapp;

import com.syni.mdd.sjb.common.component.utils.common.annotations.CheckUserIdentity;
import com.syni.mdd.sjb.common.datatreaure.controller.BaseController;
import com.syni.mdd.sjb.common.datatreaure.entity.vo.rq.saasminapp.config.*;
import com.syni.mdd.sjb.common.datatreaure.entity.vo.rq.saasminapp.delivery.*;
import com.syni.mdd.sjb.common.datatreaure.service.databank.saasminapp.DeliveryConfigService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


@RestController
@RequestMapping("/minApp/delivery")
public class DeliveryConfigController extends BaseController {

    @Autowired
    private DeliveryConfigService deliveryConfigService;

    @PostMapping("/saveDeliverySet")
    @ApiOperation(value = "保存配送设置")
    @CheckUserIdentity
    public Map<String,Object> saveDeliverySet(@RequestBody SaveDeliverySetVo saveDeliverySetVo){
        return deliveryConfigService.saveDeliverySet(saveDeliverySetVo);
    }

    @PostMapping("/getSelfConfig")
    @ApiOperation(value = "获取自提配置")
    @CheckUserIdentity
    public Map<String,Object> getSelfConfig(@RequestBody StoreIdVo storeIdVo){
        return deliveryConfigService.getSelfConfig(storeIdVo);
    }

    @PostMapping("/saveSelfConfig")
    @ApiOperation(value = "保存自提配置")
    @CheckUserIdentity
    public Map<String,Object> saveSelfConfig(@RequestBody SaveSelfConfigVo saveSelfConfigVo){
        return deliveryConfigService.saveSelfConfig(saveSelfConfigVo);
    }

    @PostMapping("/getSelfDelivery")
    @ApiOperation(value = "获取自配送配置")
    @CheckUserIdentity
    public Map<String,Object> getSelfDelivery(@RequestBody StoreIdVo storeIdVo){
        return deliveryConfigService.getSelfDelivery(storeIdVo);
    }

    @PostMapping("/saveSelfDelivery")
    @ApiOperation(value = "保存自配送配置")
    @CheckUserIdentity
    public Map<String,Object> saveSelfDelivery(@RequestBody SaveSelfDeliveryVo saveSelfDeliveryVo){
        return deliveryConfigService.saveSelfDelivery(saveSelfDeliveryVo);
    }

    @PostMapping("/getOutConfig")
    @ApiOperation(value = "获取外卖配送配置")
    @CheckUserIdentity
    public Map<String,Object> getOutConfig(@RequestBody StoreIdVo storeIdVo){
        return deliveryConfigService.getOutConfig(storeIdVo);
    }

    @PostMapping("/saveOutConfig")
    @ApiOperation(value = "保存外卖配送配置")
    @CheckUserIdentity
    public Map<String,Object> saveOutConfig(@RequestBody SaveOutConfigVo saveOutConfigVo){
        return deliveryConfigService.saveOutConfig(saveOutConfigVo);
    }

    @PostMapping("/countPostFeeRecord")
    @ApiOperation(value = "商户运费统计")
    @CheckUserIdentity
    public Map<String,Object> countPostFeeRecord(@RequestBody StoreIdVo storeIdVo){
        return deliveryConfigService.countPostFeeRecord(storeIdVo);
    }

    @PostMapping("/getPostFeeRecords")
    @ApiOperation(value = "获取运单明细")
    @CheckUserIdentity
    public Map<String,Object> getPostFeeRecords(@RequestBody StoreIdVo storeIdVo){
        return deliveryConfigService.getPostFeeRecords(storeIdVo);
    }

    @PostMapping("/postFeeRechargePrepay")
    @ApiOperation(value = "运费充值预支付")
    @CheckUserIdentity
    public Map<String,Object> postFeeRechargePrepay(@RequestBody PostFeeVo postFeeVo){
        return deliveryConfigService.postFeeRechargePrepay(postFeeVo);
    }

    @PostMapping("/getDadaBusinessType")
    @ApiOperation(value = "获取达达配送业务类型")
    @CheckUserIdentity
    public Map<String,Object> getDadaBusinessType(@RequestBody StoreIdVo storeIdVo){
        return deliveryConfigService.getDadaBusinessType(storeIdVo);
    }

    @PostMapping("/getDadaCityList")
    @ApiOperation(value = "获取达达配送城市列表")
    @CheckUserIdentity
    public Map<String,Object> getDadaCityList(@RequestBody StoreIdVo storeIdVo){
        return deliveryConfigService.getDadaCityList(storeIdVo);
    }

}
